home *** CD-ROM | disk | FTP | other *** search
- #include <ae/doorheader.h>
- #include <ae/glue.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/icon.h>
-
- #include <exec/execbase.h>
- #include <exec/memory.h>
- #include <libraries/dos.h>
- #include <libraries/dosextens.h>
- #include <devices/conunit.h>
- #include <workbench/workbench.h>
-
- #define sm sendmessage
-
- void getconfig(void);
-
- int loop=0;
- int i=0;
- int x=0;
- int counter=0;
- int count=0;
- int len;
- char string[255];
- char nodestr[5];
- int numnode=0;
- char newpath[30];
- char message[] = "\nNup Finder V1.0 by SuBhUmAnZ/LSD. (C)1994";
- char message1[]= "------------------------------------------\n";
-
- char shownup[100];
-
- struct config
- {
- char numnodes[5];
- char path[30];
- }cfg;
-
-
- void main(int argc, char *argv[])
- {
-
- struct ExecBase *SysBase = (*((struct ExecBase **) 4));
- struct IconBase *IconBase;
- struct DiskObject *dob=NULL;
-
- if(argc<2) /* AmiExpress will supply line_num on command line */
- {
- printf("Nup Finder V1.0 (C) 1994 SuBhUmAnZ/LSD\n");
- printf("This is a XIM door and must be called from /X.\n");
- exit(0);
- }
-
- Register(argv[1][0]-'0');
-
-
- sm(message,1);
- sm(message1,1);
-
- getconfig();
-
- if (SysBase->LibNode.lib_Version < 37) exit(0);
-
- IconBase= (struct IconBase *)OpenLibrary ("icon.library",37);
-
-
- for(loop=0;loop<numnode;loop++)
- {
-
- i=0;
- x=0;
-
- strcpy(newpath,cfg.path);
-
- sprintf(nodestr,"%d",loop);
- strcat(newpath,nodestr);
-
- if(IconBase) {
- dob = GetDiskObjectNew(newpath);
- if(dob && dob->do_ToolTypes) {
- while(dob->do_ToolTypes[count] && *dob->do_ToolTypes[count]) count++;
-
- while(dob->do_ToolTypes[i] && *dob->do_ToolTypes[i])
- {
-
- len = strlen(dob->do_ToolTypes[i]);
-
- if(strcmp(strncpy(string,dob->do_ToolTypes[i],17),"NEWUSER_PASSWORD=") == 0)
- { string[0]='\0';
- for(counter=17;counter<len;counter++)
- {string[x] = dob->do_ToolTypes[i][counter];
- x++;}
-
- string[x]='\0';
- x=0;
- sprintf(shownup,"The New User Password for Node %d is %s",loop,string);
- sm(shownup,1);
-
- }
- i++;
- string[0]='\0';
-
- }
-
- }
-
- }
-
- if(dob) FreeDiskObject(dob);
- }
-
- CloseLibrary((struct Library *)IconBase);
-
- sm("",1);
-
- ShutDown();
-
- exit(0);
-
- }
-
- void getconfig(void)
- {
-
- FILE *in;
- char fname[] = "doors:nup/nup.config";
- int len;
-
- if ((in = fopen(fname, "r")) == NULL)
- { sm("ERROR: Can't open doors:nup/nup.config!",1);
- ShutDown();
- end();
- }
-
- else
- {
- fgets(cfg.numnodes,5,in);
- fgets(cfg.path,30,in);
- fclose(in);
- }
-
-
- len = strlen(cfg.numnodes);
- cfg.numnodes[len-1] = '\0';
- len = strlen(cfg.path);
- cfg.path[len-1] = '\0';
-
- numnode = atoi(cfg.numnodes);
-
- return;
- }
-
- void end(void)
- {
-
- exit(0);
-
- }
-
- void LastCommand(void)
- {
-
- sm("",1);
-
- }
-